import systemModule from './modules/system';
import systemMaintence from './modules/systemMaintence';
import riskMeasureModule from './modules/riskMeasure';
import baseParamModule from './modules/baseparam';
import setting from './modules/setting';
import quota from './modules/quota';
import riskMonitoring from './modules/riskMonitoring';
import riskSettingModule from './modules/riskSetting';
import staticModule from './modules/static';
import riskTimeModule from './modules/riskTime';
import report from './modules/report';
import tradingCalendar from './modules/tradingCalendar';
import cmschina from './modules/cmschina';
import cibfund from './modules/cibfund';
import systemPreserve from './modules/systemPreserve';
import indexManage from './modules/indexManage';
import entryDiff from './modules/entryDiff';
import dataCompare from './modules/data-compare';
import { getConfigItem } from '@/utils/tools';
import fairDealing from './modules/fairDealing';
import investment from './modules/investment';

export const yhBiz = (content?: string) =>
    import(/* webpackChunkName: "@yhfin/biz" */ '@yhfin/biz').then(moudle => {
        return !content ? moudle : moudle[content];
    });
/**
 * 路由结构说明
 * {
 *     path: '/login',                                          // 登录地址
 *     name: 'login',                                           // 页面名
 *     hidden: true,                                            // 不显示在导航和 tab 标签
 *     component:
 *         () => import('@/pages/login/login.vue'),
 *     meta: {
 *         title: '风险工作台 - 登录',                           // 标题, 不写也可以
 *     },
 * },
 */
const HOME_PAGE = getConfigItem('HOME_PAGE');

const routers = [
    {
        path: '/login',
        name: 'login',
        hidden: true,
        component: () => import('@/layout/login/login.vue'),
    },
    {
        path: '',
        hidden: true,
        // redirect: '/risk/index',
        component: () => import('@/pages/layout/index.vue'),
    },
    {
        path: '',
        hidden: true,
        component: () => import('@/pages/layout/layout-content.vue'),
        children: [
            {
                name: 'PyaxaIndex',
                path: '/pyaxa/risk/index',
                component: () => import('@/pages/risk-monitoring/monitor-display.vue'),
            },
            {
                name: 'RiskIndex',
                path: '/maxWealth/risk/index',
                component: () => import('@/pages/home/risk-index.vue'),
            },
            {
                name: 'Home',
                path: HOME_PAGE,
                component: () => import('@/pages/home/home.vue'),
            },
            // {
            //     name: 'ItemSetting',
            //     path: '/risk/setting/itemSetting',
            //     component: () => import('@/pages/setting/item-setting.vue'),
            // },
            // **********招商资管路由管理 **********
            ...cmschina,
            // **********兴业路由管理 **********
            ...cibfund,
            // ********** 债券日历 **********
            ...tradingCalendar,
            // ********** 风险设置 **********
            ...setting,
            // ********** 基础参数 **********
            ...baseParamModule,
            // ********** 指标维护 **********
            ...quota,
            // ********** 系统管理 **********
            ...systemModule,
            // ********** 风险测算 **********
            ...riskMeasureModule,
            // ********** 勾稽规则 **********
            ...staticModule,
            // ********** 初始化管理 **********
            ...systemMaintence,
            // ********** 初始化管理 **********
            ...riskMonitoring,
            // ********** 实时风险 **********
            ...riskTimeModule,
            // 综合查询
            ...report,
            // ********** 系统运维 **********
            ...systemPreserve,
            // ********** 指标管理 **********
            ...indexManage,
            // ********** 条目对比 **********
            ...entryDiff,
            // ********** 数据对比 **********
            ...dataCompare,
            // ********** 公平交易 **********
            ...fairDealing,
            // 投资监督事项表
            ...investment,
            {
                // 信用分级限额专项报告
                name: 'QuotaReport',
                path: '/credit/quota/report',
                component: () => import('@/pages/credit/quota-report.vue'),
            },
            {
                name: 'CheckGroup',
                path: '/risk/check/group',
                component: () => import('@/pages/check/check-group.vue'),
            },
            {
                name: 'CheckSetting',
                path: '/risk/check/setting',
                component: () => import('@/pages/check/check-setting.vue'),
            },
            {
                name: 'CheckResult', // 勾稽规则结果
                path: '/risk/check/result',
                component: () => import('@/pages/check/check-result.vue'),
            },
            {
                name: 'CheckExecute', // 勾稽规则执行
                path: '/risk/check/execute',
                component: () => import('@/pages/check/check-execute.vue'),
            },
            // 报错页面
            {
                name: 'ErrorPage',
                path: '/error',
                component: () => import('@/pages/error/error.vue'),
            },
            {
                name: 'Error404',
                path: '/404',
                component: () => import('@/pages/error/404.vue'),
            },
            // 内部使用--系统运维页面
            {
                name: 'SystemOperations',
                path: '/systemOperations',
                component: () => import('@/pages/internal-use/system-operation.vue'),
            },
            // 内部使用--版本质检页面
            {
                name: 'VersionQualityCheck',
                path: '/versionQualityCheck',
                component: () => import('@/pages/home/version-quality-check.vue'),
            },
        ],
    },
    {
        path: '/*',
        hidden: true,
        redirect: '/404',
    },
];

// const routerChildren = [
//     {
//         path: '/error',
//         name: 'error',
//         meta: {
//             title: '异常',
//         },
//         component: () => yhBiz('Error'),
//     },
// ];

export default routers;
